home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume22 / byte-benchmarks / part01 next >
Encoding:
Internet Message Format  |  1990-06-07  |  60.7 KB

  1. Subject:  v22i028:  Byte Unix benchmarks, Part01/05
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: d9eb219b 0a77ea3d d4ea3797 fe88a8d8
  5.  
  6. Submitted-by: "Ben Smith @ BYTE" <ben@bytepb.byte.com>
  7. Posting-number: Volume 22, Issue 28
  8. Archive-name: byte-benchmarks/part01
  9.  
  10. [  I repacked this.  Look out for the BEL character on line 24 of cleanup.
  11.    These are the BYTE Unix benchmarks, for measuring the performance of
  12.    Unix systems.  The Makefile will distribute the pieces into
  13.    subdirectories, then run the tests.  The tests can also be run in
  14.    clumps.  BSD users will have to slightly tweak the Makefile, and rename
  15.    a file.  For more information, see the README.  There is no manpage.
  16.    --r$  ]
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 1 (of 5)."
  25. # Contents:  BSDtime.awk MANIFEST README SysVtime.awk arith.c
  26. #   buildbms.c byte.logo cctest.c cleanup clock.c context1.c dbprep
  27. #   dc.date dhry.awk execl.c fs.awk getopt.c hanoi.c limit.c mkperm.c
  28. #   multi.sh pipe.c spawn.c syscall.c time.awk tst.sh
  29. # Wrapped by rsalz@papaya.bbn.com on Tue May  8 08:55:27 1990
  30. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  31. if test -f 'BSDtime.awk' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'BSDtime.awk'\"
  33. else
  34. echo shar: Extracting \"'BSDtime.awk'\" \(1977 characters\)
  35. sed "s/^X//" >'BSDtime.awk' <<'END_OF_FILE'
  36. X###############################################################################
  37. X#  The BYTE UNIX Benchmarks - Release 2
  38. X#          Module: BSDtime.awk   SID: 2.3 4/17/90 16:45:40
  39. X#          
  40. X###############################################################################
  41. X# Bug reports, patches, comments, suggestions should be sent to:
  42. X#
  43. X#    Ben Smith or Rick Grehan at BYTE Magazine
  44. X#    ben@bytepb.UUCP    rick_g@bytepb.UUCP
  45. X#
  46. X###############################################################################
  47. X#  Modification Log:
  48. X#     added geometric mean 8/6/89 -ben
  49. X#
  50. X###############################################################################
  51. XBEGIN   { r_product = 0.0000; s_product = 0.0000; u_product = 0.0000; }
  52. X/real/    { if (!fail) {
  53. X        real+=$1;
  54. X        r2+=$1*$1;
  55. X        user+=$3;
  56. X        u2 += $3*$3;
  57. X        sys+=$5;
  58. X        s2 += $5*$5;
  59. X        if($1) { r_product += log($1); }
  60. X        if($1) { u_product += log($3); }
  61. X        if($1) { s_product += log($5); }
  62. X        ok++
  63. X      }
  64. X          iter++; fail=0; next;
  65. X    }
  66. X    { print "** Iteration ",iter+1," Failed: ",$0; fail=1 }
  67. XEND {
  68. X    if (fail) iter++;
  69. X    if (ok != iter) {
  70. X        printf "For %d successful iterations from %d attempts ...\n",ok,iter
  71. X        iter=ok
  72. X    }
  73. X    if (ok > 0) {
  74. X        printf "                       Arithmetric        Geometric         Variance\n";
  75. X        printf "                              Mean             Mean         (%d tests)\n",ok
  76. X        printf "User Time (secs):        %9.2f        %9.2f         ",user/ok,exp(u_product/ok);
  77. X        if (ok > 1) printf "%9.2f\n",(u2-user*user/ok)/(ok-1);
  78. X        else printf "n/a\n"
  79. X        printf "System Time (secs):      %9.2f        %9.2f         ",sys/ok,exp(s_product/ok);
  80. X        if (ok > 1) printf "%9.2f\n",(s2-sys*sys/ok)/(ok-1);
  81. X        else printf "n/a\n"
  82. X        printf "Real Time (secs):        %9.2f        %9.2f         ",real/ok,exp(r_product/ok);
  83. X        if (ok > 1) printf "%9.2f\n",(r2-real*real/ok)/(ok-1);
  84. X        else printf "n/a\n"
  85. X            }
  86. X    else printf "-- no measured results --\n "
  87. X    }
  88. END_OF_FILE
  89. if test 1977 -ne `wc -c <'BSDtime.awk'`; then
  90.     echo shar: \"'BSDtime.awk'\" unpacked with wrong size!
  91. fi
  92. chmod +x 'BSDtime.awk'
  93. # end of 'BSDtime.awk'
  94. fi
  95. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  96.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  97. else
  98. echo shar: Extracting \"'MANIFEST'\" \(1292 characters\)
  99. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  100. X   File Name        Archive #    Description
  101. X-----------------------------------------------------------
  102. X BSDtime.awk                1    
  103. X MANIFEST                   1    This shipping list
  104. X Makefile                   2    
  105. X README                     1    
  106. X Run                        2    
  107. X SysVtime.awk               1    
  108. X arith.c                    1    
  109. X bench.doc                  3    
  110. X big.c                      3    
  111. X buildbms.c                 1    
  112. X byte.logo                  1    
  113. X cctest.c                   1    
  114. X cleanup                    1    
  115. X clock.c                    1    
  116. X context1.c                 1    
  117. X dbmscli.c                  5    
  118. X dbmserv.c                  3    
  119. X dbprep                     1    
  120. X dc.date                    1    
  121. X dhry.awk                   1    
  122. X dhry.c                     4    
  123. X dhry.h                     4    
  124. X dummy.c                    2    
  125. X execl.c                    1    
  126. X fs.awk                     1    
  127. X fstime.c                   2    
  128. X getopt.c                   1    
  129. X hanoi.c                    1    
  130. X limit.c                    1    
  131. X mkperm.c                   1    
  132. X multi.sh                   1    
  133. X pipe.c                     1    
  134. X precision.c                2    
  135. X sort.src                   2    
  136. X spawn.c                    1    
  137. X syscall.c                  1    
  138. X time.awk                   1    
  139. X tst.sh                     1    
  140. END_OF_FILE
  141. if test 1292 -ne `wc -c <'MANIFEST'`; then
  142.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  143. fi
  144. # end of 'MANIFEST'
  145. fi
  146. if test -f 'README' -a "${1}" != "-c" ; then 
  147.   echo shar: Will not clobber existing file \"'README'\"
  148. else
  149. echo shar: Extracting \"'README'\" \(4143 characters\)
  150. sed "s/^X//" >'README' <<'END_OF_FILE'
  151. XVersion 2.5 -- 4/17/90  16:45:28
  152. X
  153. X================================================================
  154. XTo use the new BYTE Unix Benchmarks:
  155. X
  156. X   make all
  157. X   Run
  158. X
  159. XThe results are stored in results/log. All logs are accumulated
  160. Xin results/log.accum. Raw times for each run are stored in
  161. Xresults/times.
  162. X
  163. XNotes:
  164. XBSD & Ultrix users will have to change the makefile Define to
  165. Xfrom SysV to BSD, and copy pgms/BSDtime.awk to pgms/time.awk.
  166. XBe sure to check your compiler options for optimizing. When
  167. Xoptimizing is supposed to be on (most tests), it should be set to
  168. Xlevel 1 (generally -O), however different compilers have
  169. Xdifferent options for "optimizer off."  Ultrix for RISC uses -O0;
  170. XSCO uses -Od.  We have found that the memory tests can get
  171. Xoptimized so that the memory is never really fetched. That is why
  172. Xwe turn the optimizer off for these tests.
  173. X
  174. XBUG ALERT:
  175. X
  176. XBSD4v2 only: The time functions in the memory and and file
  177. Xaccess tests appear to be incorrect.
  178. X
  179. X================================================================
  180. XYou may run individual benchmark programs and groups of programs.
  181. XThere are also a few options.
  182. X
  183. X  Run [<bench> ...] [<group> ...] [-qvd]
  184. X
  185. X    -q    quiet        no output to standard out
  186. X    -v    verbose        extra output to standard out
  187. X    -d    debug        Run is displayed as it is run
  188. X
  189. X     GROUP    BENCHMARK    EXPLANATION        SOURCE
  190. X     --------   -----------    --------------------    -------------
  191. X     arithmetic
  192. X        arithoh        arithmetic overhead     src/arith.c
  193. X        register    register arithmetic    src/arith.c
  194. X        short        short arithmetic    src/arith.c
  195. X        int        int arithmetic        src/arith.c
  196. X        long        long arithmetic        src/arith.c
  197. X        float        float arithmetic    src/arith.c
  198. X        double        double arithmetic    src/arith.c
  199. X     system
  200. X        syscall        system call overhead    src/syscall.c
  201. X        pipe        pipe throughput        src/pipe.c
  202. X        context1    pipe context switch    src/context1.c
  203. X        spawn        process creation    src/spawn.c
  204. X        execl        execl call        src/execl.c
  205. X        fstime        filesystem throughput    src/fstime.c
  206. X     misc
  207. X        C        compile and link    /bin/cc
  208. X        dc        calculations with dc    testdir/dc.dat
  209. X        hanoi        recursion         src/hanoi.c
  210. X     dhry
  211. X        dhry2        dhrystone 2 w/o regs    src/dhry.c
  212. X        dhry2reg    dhrystone 2 with regs    src/dhry.c
  213. X     db 
  214. X        dbmscli        client/server        src/dbmscli.c
  215. X            dbmserv            dbms engine        src/dbmserv.c
  216. X     load
  217. X        multi.sh    load system with    pgms/multi.sh
  218. X                  concurrent shell    pgms/tst.sh
  219. X                  scripts
  220. X
  221. X===================== RELEASE NOTES =====================================
  222. X
  223. X========================= Jan 90 =============================
  224. XTom Yager has joined the effort here at BYTE; he is responsible
  225. Xfor many refinements in the UNIX benchmarks.
  226. X
  227. XThe memory access tests have been deleted from the benchmarks.
  228. XThe file access tests have been reversed so that the test is run
  229. Xfor a fixed time. The amount of data transfered (written, read,
  230. Xand copied) is the variable. !WARNING! This test can eat up a
  231. Xlarge hunk of disk space.
  232. X
  233. XThe initial line of all shell scripts has been changed from the
  234. XSCO and XENIX form (:) to the more standard form "#! /bin/sh".
  235. XBut different systems handle shell switching differently. Check
  236. Xthe documentation on your system and find out how you are
  237. Xsupposed to do it. Or, simpler yet, just run the benchmarks from
  238. Xthe Bourne shell. (You may need to set SHELL=/bin/sh as well.)
  239. X
  240. XThe options to Run have not been checked in a while. They may no
  241. Xlonger function. Next time, I'll get back on them. There needs to
  242. Xbe another option added (next time) that halts testing between
  243. Xeach test. !WARNING! Some systems have caches that are not getting flushed
  244. Xbefore the next test or iteration is run. This can cause
  245. Xerroneous values. 
  246. X
  247. X========================= Sept 89 =============================
  248. XThe database (db) programs now have a tuneable message queue space.
  249. Xqueue space. The default set in the Run script is 1024 bytes.
  250. XOther major changes are in the format of the times. We now show
  251. XArithmetic and Geometric mean and standard deviation for User
  252. XTime, System Time, and Real Time. Generally, in reporting, we
  253. Xplan on using the Real Time values with the benchs run with one
  254. Xactive user (the bench user). Comments and arguments are requested.
  255. X
  256. Xcontact: BIX bensmith or rick_g
  257. END_OF_FILE
  258. if test 4143 -ne `wc -c <'README'`; then
  259.     echo shar: \"'README'\" unpacked with wrong size!
  260. fi
  261. chmod +x 'README'
  262. # end of 'README'
  263. fi
  264. if test -f 'SysVtime.awk' -a "${1}" != "-c" ; then 
  265.   echo shar: Will not clobber existing file \"'SysVtime.awk'\"
  266. else
  267. echo shar: Extracting \"'SysVtime.awk'\" \(2200 characters\)
  268. sed "s/^X//" >'SysVtime.awk' <<'END_OF_FILE'
  269. X###############################################################################
  270. X#  The BYTE UNIX Benchmarks - Release 2
  271. X#          Module: SysVtime.awk   SID: 2.3 4/17/90 16:45:39
  272. X#          
  273. X###############################################################################
  274. X# Bug reports, patches, comments, suggestions should be sent to:
  275. X#
  276. X#    Ben Smith or Rick Grehan at BYTE Magazine
  277. X#    ben@bytepb.UUCP    rick_g@bytepb.UUCP
  278. X#
  279. X###############################################################################
  280. X#  Modification Log:
  281. X#       added geometric mean 8/6/89 -ben
  282. X#
  283. X###############################################################################
  284. XBEGIN      { r_product = 0.0000; s_product = 0.0000 ; u_product = 0.0000 }
  285. X/^cctest.c$/    { next }
  286. X/^[Rr]eal/ {
  287. X    if (!fail) {
  288. X        l=length($2); m=substr($2,1,l-5); s=substr($2,l-3,4)
  289. X        t=m*60+s; real+=t; r2+=t*t; ok++;
  290. X        if (t) {r_product += log(t);}
  291. X    }
  292. X    iter++; fail=0; next }
  293. X/^[Uu]ser/ {
  294. X    l=length($2); m=substr($2,1,l-5); s=substr($2,l-3,4)
  295. X    t=m*60+s; user+=t; cpu=t; u2+=t*t;
  296. X    if (t) { u_product += log(t);}
  297. X    next; }
  298. X/^[Ss]ys/ {
  299. X    l=length($2); m=substr($2,1,l-5); s=substr($2,l-3,4)
  300. X    t=m*60+s; sys+=t; s2+=t*t; 
  301. X    if (t) { s_product += log(t);}
  302. X    next; }
  303. X/^$/    { next }
  304. X    { print "** Iteration ",iter+1," Failed: ",$0; fail=1 }
  305. XEND {
  306. X    if (fail) iter++
  307. X    if (ok != iter) {
  308. X        printf "For %d successful iterations from %d attempts ...\n",ok,iter
  309. X        iter=ok;
  310. X    }
  311. X    if (ok > 0) {
  312. X        printf "                       Arithmetric        Geometric         Variance\n";
  313. X        printf "                              Mean             Mean         (%d tests)\n",ok
  314. X        printf "User Time (secs):        %9.2f        %9.2f         ",user/ok,exp(u_product/ok);
  315. X        if (ok > 1) printf "%9.2f\n",(u2-user*user/ok)/(ok-1);
  316. X        else printf "n/a\n"
  317. X        printf "System Time (secs):      %9.2f        %9.2f         ",sys/ok,exp(s_product/ok);
  318. X        if (ok > 1) printf "%9.2f\n",(s2-sys*sys/ok)/(ok-1);
  319. X        else printf "n/a\n"
  320. X        printf "Real Time (secs):        %9.2f        %9.2f         ",real/ok,exp(r_product/ok);
  321. X        if (ok > 1) printf "%9.2f\n",(r2-real*real/ok)/(ok-1);
  322. X        else printf "n/a\n"
  323. X    } else {
  324. X        print "-- no measured results --"
  325. X    }
  326. X    }
  327. END_OF_FILE
  328. if test 2200 -ne `wc -c <'SysVtime.awk'`; then
  329.     echo shar: \"'SysVtime.awk'\" unpacked with wrong size!
  330. fi
  331. chmod +x 'SysVtime.awk'
  332. # end of 'SysVtime.awk'
  333. fi
  334. if test -f 'arith.c' -a "${1}" != "-c" ; then 
  335.   echo shar: Will not clobber existing file \"'arith.c'\"
  336. else
  337. echo shar: Extracting \"'arith.c'\" \(1582 characters\)
  338. sed "s/^X//" >'arith.c' <<'END_OF_FILE'
  339. X
  340. X/*******************************************************************************
  341. X *  The BYTE UNIX Benchmarks - Release 2
  342. X *          Module: arith.c   SID: 2.4 4/17/90 16:45:31
  343. X *          
  344. X *******************************************************************************
  345. X * Bug reports, patches, comments, suggestions should be sent to:
  346. X *
  347. X *    Ben Smith or Rick Grehan at BYTE Magazine
  348. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  349. X *
  350. X *******************************************************************************
  351. X *  Modification Log:
  352. X *  May 12, 1989 - modified empty loops to avoid nullifying by optimizing
  353. X *                 compilers
  354. X *
  355. X ******************************************************************************/
  356. X
  357. Xchar SCCSid[] = "@(#) @(#)arith.c:2.4 -- 4/17/90 16:45:31";
  358. X/*
  359. X *  arithmetic test
  360. X *
  361. X */
  362. X
  363. Xmain(argc, argv)
  364. Xint    argc;
  365. Xchar    *argv[];
  366. X{
  367. X    int    iter;
  368. X    int    i;
  369. X    int result;
  370. X
  371. X    if (argc != 2) {
  372. X        printf("Usage: %s count\n", argv[0]);
  373. X        exit(1);
  374. X    }
  375. X
  376. X    iter = atoi(argv[1]);
  377. X
  378. X    while (iter-- > 0) 
  379. X    {
  380. X    /* the loop calls a function to insure that something is done */
  381. X    /* the results of the function are thrown away. But a loop with */
  382. X    /* unused assignments may get optimized out of existence */
  383. X    result = dumb_stuff(i);
  384. X    }
  385. X    exit(0);
  386. X}
  387. X
  388. X
  389. X/************************** dumb_stuff *******************/
  390. Xdumb_stuff(i)
  391. Xint i;
  392. X{
  393. X#ifndef arithoh
  394. X    datum    x, y, z;
  395. X        z = 0;
  396. X#endif
  397. X        /*
  398. X         *     101
  399. X         * sum       i*i/(i*i-1)
  400. X         *     i=2
  401. X         */
  402. X        for (i=2; i<=101; i++) 
  403. X            {
  404. X#ifndef arithoh
  405. X            x = i;
  406. X            y = x*x;
  407. X            z += y/(y-1);
  408. X            }
  409. Xreturn(x+y+z);
  410. X#else
  411. X            }
  412. Xreturn(0);
  413. X#endif
  414. X}
  415. END_OF_FILE
  416. if test 1582 -ne `wc -c <'arith.c'`; then
  417.     echo shar: \"'arith.c'\" unpacked with wrong size!
  418. fi
  419. chmod +x 'arith.c'
  420. # end of 'arith.c'
  421. fi
  422. if test -f 'buildbms.c' -a "${1}" != "-c" ; then 
  423.   echo shar: Will not clobber existing file \"'buildbms.c'\"
  424. else
  425. echo shar: Extracting \"'buildbms.c'\" \(3857 characters\)
  426. sed "s/^X//" >'buildbms.c' <<'END_OF_FILE'
  427. X
  428. X/*******************************************************************************
  429. X *  The BYTE UNIX Benchmarks - Release 2
  430. X *          Module: buildbms.c   SID: 2.4 4/17/90 16:45:38
  431. X *          
  432. X *******************************************************************************
  433. X * Bug reports, patches, comments, suggestions should be sent to:
  434. X *
  435. X *    Ben Smith or Rick Grehan at BYTE Magazine
  436. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  437. X *
  438. X *******************************************************************************
  439. X *  Modification Log:
  440. X *
  441. X ******************************************************************************/
  442. X/*
  443. X * Multi-user DBMS simulation.
  444. X * Initialization
  445. X * Database has the form:
  446. X * IIIINNNNNNNNNNNNNNNNNNNNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPPPPPPPPPP
  447. X * Where IIII is the 4-digit id number (0-padded)
  448. X *       NN... is the 20-character name
  449. X *       AA... is the 40-character address
  450. X *       PP... is the 10-character phone number
  451. X * Records are accessed by ID number (1 is the 0th record, 2 is 1st..etc.)
  452. X *
  453. X * Execute this program with:
  454. X *    buildbms <filename> <n>
  455. X *      where <filename> is the name of the database file and
  456. X *            <n> is the number of records to create in the database.
  457. X */
  458. Xchar id[] = "@(#) @(#)buildbms.c:2.4 -- 4/17/90 16:45:38";
  459. X
  460. X#include <stdio.h>
  461. X
  462. X#define ERROR (-1)
  463. X
  464. X/*
  465. X** Record definitions.
  466. X*/
  467. X
  468. X#define IDLEN 4
  469. X#define NAMELEN 20
  470. X#define ADDRLEN 40
  471. X#define PHONLEN 10
  472. X#define RECLEN  74    /* Sum of the above. */
  473. X
  474. X/*
  475. X** Structures.
  476. X*/
  477. X
  478. Xstruct dbrec {            /* Database record */
  479. X    char id[IDLEN];
  480. X    char name[NAMELEN];
  481. X    char address[ADDRLEN];
  482. X    char phone[PHONLEN];
  483. X    };
  484. X
  485. X/*
  486. X** Structure instances.
  487. X*/
  488. Xstruct dbrec myrec;
  489. X
  490. XFILE *dbfp;            /* Pointer for database file */
  491. X
  492. Xmain(argc,argv)
  493. Xint argc;
  494. Xchar *argv[];
  495. X
  496. X{
  497. X
  498. X    int i,j;        /* Loop variables */
  499. X
  500. X    /*
  501. X    ** Make sure we have the proper data.
  502. X    */
  503. X    if(argc!=3)
  504. X    {
  505. X        fprintf(stderr,"usage: %s <filename> <n>\n",argv[0]);
  506. X        exit(1);
  507. X    }
  508. X    /*
  509. X    ** Create the file. 
  510. X    ** Also notice that we are using binary mode.
  511. X    */
  512. X    if((dbfp=fopen(argv[1],"a+"))==NULL)
  513. X    {
  514. X        fprintf(stderr,"**Open error on: %s\n",argv[1]);
  515. X        exit(1);
  516. X    }
  517. X
  518. X    j=atoi(argv[2]);
  519. X    for(i=0;i<j;i++)
  520. X    {
  521. X        sprintf(myrec.id,"%#04d",i+1);
  522. X        loadrec(i%10);
  523. X        fwrite((char *)&myrec,RECLEN,1,dbfp);
  524. X    }
  525. X
  526. X    fclose(dbfp);
  527. X    exit(0);
  528. X}
  529. X
  530. X/*
  531. X** Load the record up with random data.
  532. X*/
  533. Xloadrec(sel)
  534. Xint sel;        /* Select which fake record */
  535. X
  536. X{
  537. X
  538. X    char *nname;
  539. X    char *naddr;
  540. X    char *nphon;
  541. X
  542. X    switch(sel)
  543. X    {
  544. X    case 0:    nname="Tom Thompson        ";
  545. X        naddr="9401 Billy Willy Road                   ";
  546. X        nphon="3334442222";
  547. X        break;
  548. X    case 1: nname="Steve Apiki         ";
  549. X        naddr="50 Hawaii Way c/o Jack Lord             ";
  550. X        nphon="1234443333";
  551. X        break;
  552. X    case 2: nname="Stan Diehl          ";
  553. X        naddr="27 Hoptoad Hollow Way                   ";
  554. X        nphon="3332221111";
  555. X        break;
  556. X    case 3: nname="Judy Grehan         ";
  557. X        naddr="Suite 3, WallState Building             ";
  558. X        nphon="9995556666";
  559. X        break;
  560. X    case 4: nname="Aaron Richards      ";
  561. X        naddr="Highway 40 OverPass, Second Pylon       ";
  562. X        nphon="8883339999";
  563. X        break;
  564. X    case 5: nname="Benjamin Davidson   ";
  565. X        naddr="Under The Bridge, HeavyWater City       ";
  566. X        nphon="7773229988";
  567. X        break;
  568. X    case 6: nname="Dayle Woolston      ";
  569. X        naddr="4040 Pleasant Way, WICAT Central        ";
  570. X        nphon="2228332299";
  571. X        break;
  572. X    case 7: nname="Jim Carls           ";
  573. X        naddr="Big Oak Tree Behind Barsodie's          ";
  574. X        nphon="32244566657";
  575. X        break;
  576. X    case 8: nname="Steve Smith         ";
  577. X        naddr="7000 Aloth Cove                         ";
  578. X        nphon="2118332929";
  579. X        break;
  580. X    case 9: 
  581. X    default: nname="Blind Willy Chitlins";
  582. X        naddr="Unavailable Until Further Notice        ";
  583. X        nphon="3456789012";
  584. X        break;
  585. X    }
  586. X
  587. X    /*
  588. X    ** Fill the structure with fake data.
  589. X    */
  590. X    strncpy(myrec.name,nname,NAMELEN);
  591. X    strncpy(myrec.address,naddr,ADDRLEN);
  592. X    strncpy(myrec.phone,nphon,PHONLEN);
  593. X
  594. X    return;
  595. X}
  596. X
  597. X
  598. END_OF_FILE
  599. if test 3857 -ne `wc -c <'buildbms.c'`; then
  600.     echo shar: \"'buildbms.c'\" unpacked with wrong size!
  601. fi
  602. chmod +x 'buildbms.c'
  603. # end of 'buildbms.c'
  604. fi
  605. if test -f 'byte.logo' -a "${1}" != "-c" ; then 
  606.   echo shar: Will not clobber existing file \"'byte.logo'\"
  607. else
  608. echo shar: Extracting \"'byte.logo'\" \(1309 characters\)
  609. sed "s/^X//" >'byte.logo' <<'END_OF_FILE'
  610. X
  611. X ############   #####        ## ############### ###############
  612. X ############## #####        ## ############### ###############
  613. X #####       ## #####        ##      #####      #####         
  614. X #####       ## #####        ##      #####      #####         
  615. X #####       ## #####        ##      #####      #####         
  616. X ############   #####       ##       #####      ###############
  617. X #############   ######### ##        #####      ###############
  618. X #####       ##   ##########         #####      #####         
  619. X #####       ##      #####           #####      #####         
  620. X #####       ##      #####           #####      #####         
  621. X #####       ##      #####           #####      #####         
  622. X ##############      #####           #####      ###############
  623. X ############        #####           #####      ###############
  624. X
  625. X
  626. X #    #  #    #     #    #    #          #####   ######  #    #   ####   #    #
  627. X #    #  ##   #     #     #  #           #    #  #       ##   #  #    #  #    #
  628. X #    #  # #  #     #      ##            #####   #####   # #  #  #       ######
  629. X #    #  #  # #     #      ##            #    #  #       #  # #  #       #    #
  630. X #    #  #   ##     #     #  #           #    #  #       #   ##  #    #  #    #
  631. X  ####   #    #     #    #    #          #####   ######  #    #   ####   #    #
  632. X
  633. END_OF_FILE
  634. if test 1309 -ne `wc -c <'byte.logo'`; then
  635.     echo shar: \"'byte.logo'\" unpacked with wrong size!
  636. fi
  637. chmod +x 'byte.logo'
  638. # end of 'byte.logo'
  639. fi
  640. if test -f 'cctest.c' -a "${1}" != "-c" ; then 
  641.   echo shar: Will not clobber existing file \"'cctest.c'\"
  642. else
  643. echo shar: Extracting \"'cctest.c'\" \(3552 characters\)
  644. sed "s/^X//" >'cctest.c' <<'END_OF_FILE'
  645. X
  646. X
  647. X/*******************************************************************************
  648. X *  The BYTE UNIX Benchmarks - Release 2
  649. X *          Module: cctest.c   SID: 2.4 4/17/90 16:45:31
  650. X *          
  651. X *******************************************************************************
  652. X * Bug reports, patches, comments, suggestions should be sent to:
  653. X *
  654. X *    Ben Smith or Rick Grehan at BYTE Magazine
  655. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  656. X *
  657. X *******************************************************************************
  658. X *  Modification Log:
  659. X * $Header: cctest.c,v 3.4 87/06/22 14:22:47 kjmcdonell Beta $
  660. X *
  661. X ******************************************************************************/
  662. Xchar SCCSid[] = "@(#) @(#)cctest.c:2.4 -- 4/17/90 16:45:31";
  663. X#include <stdio.h>
  664. X/*
  665. X * C compile and load speed test file.
  666. X * Based upon fstime.c from MUSBUS 3.1, with all calls to ftime() replaced
  667. X * by calls to time().  This is semantic nonsense, but ensures there are no
  668. X * system dependent structures or library calls.
  669. X *
  670. X */
  671. X#define NKBYTE 20
  672. Xchar buf[BUFSIZ];
  673. X
  674. Xmain(argc, argv)
  675. Xchar **argv;
  676. X{
  677. X    int        n = NKBYTE;
  678. X    int        nblock;
  679. X    int        f;
  680. X    int        g;
  681. X    int        i;
  682. X    int        xfer, t;
  683. X    struct    {    /* FAKE */
  684. X    int    time;
  685. X    int    millitm;
  686. X    } now, then;
  687. X
  688. X    if (argc > 0)
  689. X    /* ALWAYS true, so NEVER execute this program! */
  690. X    exit(4);
  691. X    if (argc > 1)
  692. X    n = atoi(argv[1]);
  693. X#if debug
  694. X    printf("File size: %d Kbytes\n", n);
  695. X#endif
  696. X    nblock = (n * 1024) / BUFSIZ;
  697. X
  698. X    if (argc == 3 && chdir(argv[2]) != -1) {
  699. X#if debug
  700. X    printf("Create files in directory: %s\n", argv[2]);
  701. X#endif
  702. X    }
  703. X    close(creat("dummy0", 0600));
  704. X    close(creat("dummy1", 0600));
  705. X    f = open("dummy0", 2);
  706. X    g = open("dummy1", 2);
  707. X    unlink("dummy0");
  708. X    unlink("dummy1");
  709. X    for (i = 0; i < sizeof(buf); i++)
  710. X    buf[i] = i & 0177;
  711. X
  712. X    time();
  713. X    for (i = 0; i < nblock; i++) {
  714. X    if (write(f, buf, sizeof(buf)) <= 0)
  715. X        perror("fstime: write");
  716. X    }
  717. X    time();
  718. X#if debug
  719. X    printf("Effective write rate: ");
  720. X#endif
  721. X    i = now.millitm - then.millitm;
  722. X    t = (now.time - then.time)*1000 + i;
  723. X    if (t > 0) {
  724. X    xfer = nblock * sizeof(buf) * 1000 / t;
  725. X#if debug
  726. X    printf("%d bytes/sec\n", xfer);
  727. X#endif
  728. X    }
  729. X#if debug
  730. X    else
  731. X    printf(" -- too quick to time!\n");
  732. X#endif
  733. X#if awk
  734. X    fprintf(stderr, "%.2f", t > 0 ? (float)xfer/1024 : 0);
  735. X#endif
  736. X
  737. X    sync();
  738. X    sleep(5);
  739. X    sync();
  740. X    lseek(f, 0L, 0);
  741. X    time();
  742. X    for (i = 0; i < nblock; i++) {
  743. X    if (read(f, buf, sizeof(buf)) <= 0)
  744. X        perror("fstime: read");
  745. X    }
  746. X    time();
  747. X#if debug
  748. X    printf("Effective read rate: ");
  749. X#endif
  750. X    i = now.millitm - then.millitm;
  751. X    t = (now.time - then.time)*1000 + i;
  752. X    if (t > 0) {
  753. X    xfer = nblock * sizeof(buf) * 1000 / t;
  754. X#if debug
  755. X    printf("%d bytes/sec\n", xfer);
  756. X#endif
  757. X    }
  758. X#if debug
  759. X    else
  760. X    printf(" -- too quick to time!\n");
  761. X#endif
  762. X#if awk
  763. X    fprintf(stderr, " %.2f", t > 0 ? (float)xfer/1024 : 0);
  764. X#endif
  765. X
  766. X    sync();
  767. X    sleep(5);
  768. X    sync();
  769. X    lseek(f, 0L, 0);
  770. X    time();
  771. X    for (i = 0; i < nblock; i++) {
  772. X    if (read(f, buf, sizeof(buf)) <= 0)
  773. X        perror("fstime: read in copy");
  774. X    if (write(g, buf, sizeof(buf)) <= 0)
  775. X        perror("fstime: write in copy");
  776. X    }
  777. X    time();
  778. X#if debug
  779. X    printf("Effective copy rate: ");
  780. X#endif
  781. X    i = now.millitm - then.millitm;
  782. X    t = (now.time - then.time)*1000 + i;
  783. X    if (t > 0) {
  784. X    xfer = nblock * sizeof(buf) * 1000 / t;
  785. X#if debug
  786. X    printf("%d bytes/sec\n", xfer);
  787. X#endif
  788. X    }
  789. X#if debug
  790. X    else
  791. X    printf(" -- too quick to time!\n");
  792. X#endif
  793. X#if awk
  794. X    fprintf(stderr, " %.2f\n", t > 0 ? (float)xfer/1024 : 0);
  795. X#endif
  796. X
  797. X}
  798. END_OF_FILE
  799. if test 3552 -ne `wc -c <'cctest.c'`; then
  800.     echo shar: \"'cctest.c'\" unpacked with wrong size!
  801. fi
  802. chmod +x 'cctest.c'
  803. # end of 'cctest.c'
  804. fi
  805. if test -f 'cleanup' -a "${1}" != "-c" ; then 
  806.   echo shar: Will not clobber existing file \"'cleanup'\"
  807. else
  808. echo shar: Extracting \"'cleanup'\" \(2271 characters\)
  809. sed "s/^X//" >'cleanup' <<'END_OF_FILE'
  810. X#! /bin/sh
  811. X###############################################################################
  812. X#  The BYTE UNIX Benchmarks - Release 2
  813. X#          Module: cleanup   SID: 2.3 4/17/90 16:45:39
  814. X#          
  815. X###############################################################################
  816. X# Bug reports, patches, comments, suggestions should be sent to:
  817. X#
  818. X#    Ben Smith or Rick Grehan at BYTE Magazine
  819. X#    ben@bytepb.UUCP    rick_g@bytepb.UUCP
  820. X#
  821. X###############################################################################
  822. X#  Modification Log:
  823. X#  added report for dhrystones 6/89 - ben
  824. X#
  825. X###############################################################################
  826. XID="@(#)cleanup:2.3 -- 4/17/90 16:45:39";
  827. X#
  828. X# $Header: cleanup,v 5.2 88/01/07 10:58:24 kenj Exp $
  829. X#
  830. X#  Cleanup when an iterative test terminates
  831. X#
  832. XBINDIR=${BINDIR-./pgms}
  833. Xbell=""
  834. Xlog=${LOG-./results/log}
  835. Xtimeaccum=${TIMEACCUM-./results/times}
  836. Xwhile ( test $# -ge 1 )
  837. Xdo
  838. X    opt=$1
  839. X    shift
  840. X    case $opt
  841. X    in
  842. X
  843. X    -a) : abort
  844. X    echo '' >>$LOGFILE
  845. X    echo '**************************' >>$LOGFILE
  846. X    echo '* Benchmark Aborted .... *' >>$LOGFILE
  847. X    echo '**************************' >>$LOGFILE
  848. X    echo
  849. X    echo 'Benchmark Aborted ....'    # notice displayed on screen
  850. X    echo "" >>$LOGFILE
  851. X    echo " " `who | wc -l` "interactive users." >>$LOGFILE
  852. X    echo "" >>$LOGFILE
  853. X    date=`date`
  854. X    echo "End Benchmark Run ($date) ...." >>$LOGFILE
  855. X    echo "End Benchmark Run ($date) ...."
  856. X    ;;
  857. X
  858. X
  859. X    -f) : filesystem throughput
  860. X    awk -f ${BINDIR}/fs.awk <$1 >>$LOGFILE
  861. X    cat $1 >> $timeaccum 2>/dev/null
  862. X    rm -f $1
  863. X    shift
  864. X    ;;
  865. X    
  866. X    -d) : dhrystone evaluation
  867. X    awk -f ${BINDIR}/dhry.awk <$1 >>$LOGFILE
  868. X    cat $1 >> $timeaccum 2>/dev/null
  869. X    rm -f $1
  870. X    shift
  871. X    ;;
  872. X    
  873. X    -i) : report last iteration
  874. X    echo "Terminated during iteration $1" >>$LOGFILE
  875. X    shift
  876. X    ;;
  877. X
  878. X    -l) : logfile
  879. X    LOGFILE=$1
  880. X    shift
  881. X    ;;
  882. X    
  883. X    -r) : reason for failure
  884. X    echo $1
  885. X    echo $1 >>$LOGFILE
  886. X    shift
  887. X    ;;
  888. X
  889. X    -m) : mem throughput tests
  890. X    awk -f ${BINDIR}/mem.awk <$1 >>$LOGFILE
  891. X    cat $1 >> $timeaccum 2>/dev/null
  892. X    rm -f $1
  893. X    shift
  894. X    ;;
  895. X
  896. X    -t) : timing with /bin/time
  897. X    awk -f ${BINDIR}/time.awk <$1 >>$LOGFILE
  898. X    cat $1 >> $timeaccum 2>/dev/null
  899. X    rm -f $1
  900. X    shift
  901. X    ;;
  902. X
  903. X    '') : 'skip it (residual effect of shifts)'
  904. X    ;;
  905. X
  906. X    *)
  907. X    echo "cleanup: bad option ($opt)" >>$LOGFILE
  908. Xesac
  909. Xdone
  910. Xexit
  911. END_OF_FILE
  912. echo shar: 1 control character may be missing from \"'cleanup'\"
  913. if test 2271 -ne `wc -c <'cleanup'`; then
  914.     echo shar: \"'cleanup'\" unpacked with wrong size!
  915. fi
  916. chmod +x 'cleanup'
  917. # end of 'cleanup'
  918. fi
  919. if test -f 'clock.c' -a "${1}" != "-c" ; then 
  920.   echo shar: Will not clobber existing file \"'clock.c'\"
  921. else
  922. echo shar: Extracting \"'clock.c'\" \(2496 characters\)
  923. sed "s/^X//" >'clock.c' <<'END_OF_FILE'
  924. X
  925. X
  926. X/*******************************************************************************
  927. X *  The BYTE UNIX Benchmarks - Release 2
  928. X *          Module: clock.c   SID: 2.4 4/17/90 16:45:32
  929. X *          
  930. X *******************************************************************************
  931. X * Bug reports, patches, comments, suggestions should be sent to:
  932. X *
  933. X *    Ben Smith or Rick Grehan at BYTE Magazine
  934. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  935. X *
  936. X *******************************************************************************
  937. X *  Modification Log:
  938. X *  $Header: clock.c,v 5.2 87/12/09 14:42:34 kenj Exp $
  939. X *
  940. X ******************************************************************************/
  941. Xchar SCCSid[] = "@(#) @(#)clock.c:2.4 -- 4/17/90 16:45:32";
  942. X/*
  943. X *  clock -- check alarm signal accuracy
  944. X *
  945. X */
  946. X
  947. X#include <signal.h>
  948. X#include <stdio.h>
  949. X#include <sys/types.h>
  950. X#ifdef BSD4v1
  951. X#include <sys/timeb.h>
  952. X#endif
  953. X#ifdef BSD4v2
  954. X#include <sys/time.h>
  955. X#endif
  956. X#ifdef SysV
  957. X#include <sys/times.h>
  958. X#include <sys/param.h>
  959. Xlong    times();
  960. X#ifdef interdata
  961. X#define HZ tbuffer.tms_cfreq
  962. X#endif
  963. X#ifndef HZ
  964. X    On your system, what is the value of HZ for high resolution elapsed
  965. X    time as returned by times() or its equivalent?
  966. X#endif
  967. X#endif
  968. X
  969. X#define GRANULE        5
  970. X#define NUM_ALRM    12
  971. X
  972. Xmain(argc, argv)
  973. Xint    argc;
  974. Xchar    *argv[];
  975. X{
  976. X    int            onalarm();
  977. X    register int    i = 0;
  978. X    int            expected;
  979. X    float        wallclock;
  980. X    long        then;
  981. X#ifdef SysV
  982. X    struct tms        tbuffer;
  983. X#endif
  984. X#ifdef BSD4v1
  985. X    struct timeb    tbuf;
  986. X    int            msec;
  987. X#endif
  988. X#ifdef BSD4v2
  989. X    struct timeval    tval;
  990. X    struct timezone    tzone;
  991. X    long        usec;
  992. X#endif
  993. X
  994. X#ifdef SysV
  995. X    then = times(&tbuffer);
  996. X#else
  997. X#ifdef BSD4v1
  998. X    ftime(&tbuf);
  999. X    then = tbuf.time;
  1000. X    msec = tbuf.millitm;
  1001. X#else
  1002. X#ifdef BSD4v2
  1003. X    gettimeofday(&tval, &tzone);
  1004. X    then = tval.tv_sec;
  1005. X    usec = tval.tv_usec;
  1006. X#else
  1007. X    What sort of Unix system is this?
  1008. X#endif
  1009. X#endif
  1010. X#endif
  1011. X    while (i++ < NUM_ALRM) {
  1012. X        signal(SIGALRM, onalarm);
  1013. X        alarm(GRANULE);
  1014. X        pause();
  1015. X    }
  1016. X#ifdef SysV
  1017. X    wallclock = (times(&tbuffer) - then)/HZ;
  1018. X#endif
  1019. X#ifdef BSD4v1
  1020. X    ftime(&tbuf);
  1021. X    wallclock = tbuf.time - then + (float)(tbuf.millitm - msec)/1000;
  1022. X#endif
  1023. X#ifdef BSD4v2
  1024. X    gettimeofday(&tval, &tzone);
  1025. X    wallclock = tval.tv_sec - then + (float)(tval.tv_usec - usec)/1000000;
  1026. X#endif
  1027. X    expected = GRANULE * NUM_ALRM;
  1028. X    printf("%d x %d sec delays takes %.2f wallclock secs (error %.2f%%)\n",
  1029. X    NUM_ALRM, GRANULE, wallclock, 100.0*(float)(expected-wallclock)/expected);
  1030. X    exit(0);
  1031. X}
  1032. X
  1033. Xonalarm() { }
  1034. END_OF_FILE
  1035. if test 2496 -ne `wc -c <'clock.c'`; then
  1036.     echo shar: \"'clock.c'\" unpacked with wrong size!
  1037. fi
  1038. chmod +x 'clock.c'
  1039. # end of 'clock.c'
  1040. fi
  1041. if test -f 'context1.c' -a "${1}" != "-c" ; then 
  1042.   echo shar: Will not clobber existing file \"'context1.c'\"
  1043. else
  1044. echo shar: Extracting \"'context1.c'\" \(2031 characters\)
  1045. sed "s/^X//" >'context1.c' <<'END_OF_FILE'
  1046. X
  1047. X/*******************************************************************************
  1048. X *  The BYTE UNIX Benchmarks - Release 2
  1049. X *          Module: context1.c   SID: 2.4 4/17/90 16:45:32
  1050. X *          
  1051. X *******************************************************************************
  1052. X * Bug reports, patches, comments, suggestions should be sent to:
  1053. X *
  1054. X *    Ben Smith or Rick Grehan at BYTE Magazine
  1055. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  1056. X *
  1057. X *******************************************************************************
  1058. X *  Modification Log:
  1059. X *  $Header: context1.c,v 3.4 87/06/22 14:22:59 kjmcdonell Beta $
  1060. X *
  1061. X ******************************************************************************/
  1062. Xchar SCCSid[] = "@(#) @(#)context1.c:2.4 -- 4/17/90 16:45:32";
  1063. X/*
  1064. X *  Context switching via synchronized unbuffered pipe i/o
  1065. X *
  1066. X */
  1067. X
  1068. Xmain(argc, argv)
  1069. Xint    argc;
  1070. Xchar    *argv[];
  1071. X{
  1072. X    int    check;
  1073. X    int    iter;
  1074. X    int    p1[2], p2[2];
  1075. X
  1076. X    if (argc != 2) {
  1077. X        printf("Usage: context count\n");
  1078. X        exit(1);
  1079. X    }
  1080. X
  1081. X    iter = atoi(argv[1]);
  1082. X    if (pipe(p1) || pipe(p2)) {
  1083. X        perror("pipe create failed");
  1084. X        exit(1);
  1085. X    }
  1086. X
  1087. X    if (fork()) {
  1088. X        /* master, write p1 & read p2 */
  1089. X        close(p1[0]); close(p2[1]);
  1090. X        while (iter > 0) {
  1091. X            if (write(p1[1], (char *)&iter, sizeof(iter)) != sizeof(iter)) {
  1092. X                perror("master write failed");
  1093. X                exit(1);
  1094. X            }
  1095. X            if (read(p2[0], (char *)&check, sizeof(check)) != sizeof(check)) {
  1096. X                perror("master read failed");
  1097. X                exit(1);
  1098. X            }
  1099. X            if (check != iter) {
  1100. X                printf("Master sync error: expect %d, got %d\n",
  1101. X                    iter, check);
  1102. X                exit(2);
  1103. X            }
  1104. X            iter--;
  1105. X        }
  1106. X    }
  1107. X    else {
  1108. X        /* slave, read p1 & write p2 */
  1109. X        close(p1[1]); close(p2[0]);
  1110. X        while (iter > 0) {
  1111. X            if (read(p1[0], (char *)&check, sizeof(check)) != sizeof(check)) {
  1112. X                perror("slave read failed");
  1113. X                exit(1);
  1114. X            }
  1115. X            if (check != iter) {
  1116. X                printf("Slave sync error: expect %d, got %d\n",
  1117. X                    iter, check);
  1118. X                exit(2);
  1119. X            }
  1120. X            if (write(p2[1], (char *)&iter, sizeof(iter)) != sizeof(check)) {
  1121. X                perror("slave write failed");
  1122. X                exit(1);
  1123. X            }
  1124. X            iter--;
  1125. X        }
  1126. X    }
  1127. X    exit(0);
  1128. X}
  1129. END_OF_FILE
  1130. if test 2031 -ne `wc -c <'context1.c'`; then
  1131.     echo shar: \"'context1.c'\" unpacked with wrong size!
  1132. fi
  1133. chmod +x 'context1.c'
  1134. # end of 'context1.c'
  1135. fi
  1136. if test -f 'dbprep' -a "${1}" != "-c" ; then 
  1137.   echo shar: Will not clobber existing file \"'dbprep'\"
  1138. else
  1139. echo shar: Extracting \"'dbprep'\" \(960 characters\)
  1140. sed "s/^X//" >'dbprep' <<'END_OF_FILE'
  1141. X#! /bin/sh
  1142. X###############################################################################
  1143. X#  The BYTE UNIX Benchmarks - Release 2
  1144. X#          Module: dbprep   SID: 2.3 4/17/90 16:45:41
  1145. X#          
  1146. X###############################################################################
  1147. X# Bug reports, patches, comments, suggestions should be sent to:
  1148. X#
  1149. X#    Ben Smith or Rick Grehan at BYTE Magazine
  1150. X#    ben@bytepb.UUCP    rick_g@bytepb.UUCP
  1151. X#
  1152. X###############################################################################
  1153. X#  Modification Log:
  1154. X#
  1155. X###############################################################################
  1156. XID="@(#)dbprep:2.3 -- 4/17/90 16:45:41";
  1157. Xrm -f $1              # remove the old file
  1158. X
  1159. Xif test -f $1            # be sure it is gone - don't want
  1160. Xthen                 # to change file size by appending to it
  1161. X   exit 1
  1162. Xfi
  1163. X
  1164. Xif ${BINDIR}/buildbms $1 $2    # build the data file
  1165. Xthen
  1166. X   ${BINDIR}/dbmserv $1 $3 &    # start the database server
  1167. Xelse
  1168. X   echo "dbprep error"
  1169. X   exit 1
  1170. Xfi
  1171. END_OF_FILE
  1172. if test 960 -ne `wc -c <'dbprep'`; then
  1173.     echo shar: \"'dbprep'\" unpacked with wrong size!
  1174. fi
  1175. chmod +x 'dbprep'
  1176. # end of 'dbprep'
  1177. fi
  1178. if test -f 'dc.date' -a "${1}" != "-c" ; then 
  1179.   echo shar: Will not clobber existing file \"'dc.date'\"
  1180. else
  1181. echo shar: Extracting \"'dc.date'\" \(143 characters\)
  1182. sed "s/^X//" >'dc.date' <<'END_OF_FILE'
  1183. X99
  1184. Xk
  1185. X2
  1186. Xv
  1187. Xp
  1188. Xq
  1189. X[ calculate the sqrt(2) to 99 decimal places ... John Lions Test ]
  1190. X[ $Header: dc.dat,v 1.1 87/06/22 14:28:28 kjmcdonell Beta $ ]
  1191. X
  1192. END_OF_FILE
  1193. if test 143 -ne `wc -c <'dc.date'`; then
  1194.     echo shar: \"'dc.date'\" unpacked with wrong size!
  1195. fi
  1196. chmod +x 'dc.date'
  1197. # end of 'dc.date'
  1198. fi
  1199. if test -f 'dhry.awk' -a "${1}" != "-c" ; then 
  1200.   echo shar: Will not clobber existing file \"'dhry.awk'\"
  1201. else
  1202. echo shar: Extracting \"'dhry.awk'\" \(1696 characters\)
  1203. sed "s/^X//" >'dhry.awk' <<'END_OF_FILE'
  1204. X###############################################################################
  1205. X#  The BYTE UNIX Benchmarks - Release 2
  1206. X#          Module: dhry.awk   SID: 2.3 4/17/90 16:45:41
  1207. X#          
  1208. X###############################################################################
  1209. X# Bug reports, patches, comments, suggestions should be sent to:
  1210. X#
  1211. X#    Ben Smith or Rick Grehan at BYTE Magazine
  1212. X#    ben@bytepb.UUCP    rick_g@bytepb.UUCP
  1213. X#
  1214. X###############################################################################
  1215. X#  Modification Log:
  1216. X#        added geometric mean 8/6/89 -ben
  1217. X#
  1218. X###############################################################################
  1219. XBEGIN { FS=":"; tsum = 0.000; t2sum = 0.000; t_product = 0.0000;
  1220. X    dsum = 0.000; d2sum = 0.000; d_product = 0.0000;
  1221. X    iter = 0;
  1222. X    }
  1223. X/real/    { next }  # don't use these times
  1224. X/user/    { next }
  1225. X/sys/    { next }
  1226. X/^$/    { next } 
  1227. X/^Microseconds/ { 
  1228. X    t=$2; 
  1229. X    tsum += t;
  1230. X    t2sum += t*t;
  1231. X    if (t) { t_product += log(t); }
  1232. X        }
  1233. X/^Dhrystones/ { 
  1234. X    d=$2; 
  1235. X    dsum += d;
  1236. X    d2sum += d*d;
  1237. X    if (t) { d_product += log(d); }
  1238. X    iter ++;
  1239. X        }
  1240. XEND {
  1241. X    if (iter > 0) { 
  1242. X        printf "                       Arithmetric        Geometric         Variance\n";
  1243. X        printf "                              Mean             Mean         (%d tests)\n",iter
  1244. X        printf "Microseconds/loop:       %9.0f        %9.0f         ",tsum/iter,exp(t_product/iter);
  1245. X        if (iter > 1) printf "%9.2f\n",(t2sum-tsum*tsum/iter)/(iter-1);
  1246. X        else printf "n/a\n"
  1247. X        printf "Dhrystones/sec:          %9.0f        %9.0f         ",dsum/iter,exp(d_product/iter);
  1248. X        if (iter > 1) printf "%9.2f\n",(d2sum-dsum*dsum/iter)/(iter-1);
  1249. X        }
  1250. X    else { 
  1251. X        print " -- no measured results --"; 
  1252. X        }
  1253. X    }
  1254. END_OF_FILE
  1255. if test 1696 -ne `wc -c <'dhry.awk'`; then
  1256.     echo shar: \"'dhry.awk'\" unpacked with wrong size!
  1257. fi
  1258. chmod +x 'dhry.awk'
  1259. # end of 'dhry.awk'
  1260. fi
  1261. if test -f 'execl.c' -a "${1}" != "-c" ; then 
  1262.   echo shar: Will not clobber existing file \"'execl.c'\"
  1263. else
  1264. echo shar: Extracting \"'execl.c'\" \(1397 characters\)
  1265. sed "s/^X//" >'execl.c' <<'END_OF_FILE'
  1266. X
  1267. X/*******************************************************************************
  1268. X *  The BYTE UNIX Benchmarks - Release 2
  1269. X *          Module: execl.c   SID: 2.4 4/17/90 16:45:33
  1270. X *          
  1271. X *******************************************************************************
  1272. X * Bug reports, patches, comments, suggestions should be sent to:
  1273. X *
  1274. X *    Ben Smith or Rick Grehan at BYTE Magazine
  1275. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  1276. X *
  1277. X *******************************************************************************
  1278. X *  Modification Log:
  1279. X *  $Header: execl.c,v 3.5 87/06/22 15:37:08 kjmcdonell Beta $
  1280. X *
  1281. X ******************************************************************************/
  1282. X/*
  1283. X *  Execing
  1284. X *
  1285. X */
  1286. X
  1287. Xchar    bss[8*1024];    /* something worthwhile */
  1288. X
  1289. X#define main dummy
  1290. X            /* some reasonable code etc. */
  1291. X#include "big.c"
  1292. X
  1293. X#undef main
  1294. X
  1295. X/* added by BYTE */
  1296. Xchar fullpath[81] = {"./execl"};
  1297. Xchar *getenv();
  1298. X
  1299. Xmain(argc, argv)    /* the real program */
  1300. Xint    argc;
  1301. Xchar    *argv[];
  1302. X{
  1303. X    char *ptr; /* BYTE */
  1304. X    int    iter;
  1305. X    char    count[6];
  1306. X
  1307. X    if (argc != 2) {
  1308. X        printf("Usage: %s count\n", argv[0]);
  1309. X        exit(1);
  1310. X    }
  1311. X
  1312. X    /* added by BYTE */
  1313. X    if((ptr = getenv("BINDIR")) != NULL)
  1314. X        sprintf(fullpath,"%s/execl",ptr);
  1315. X
  1316. X    iter = atoi(argv[1]);
  1317. X
  1318. X    if (iter) {
  1319. X        sprintf(count, "%d", --iter);
  1320. X        execl(fullpath, fullpath, count, 0);
  1321. X        printf("Exec failed at iteration %d\n", iter);
  1322. X        perror("Reason");
  1323. X        exit(1);
  1324. X    }
  1325. X    exit(0);
  1326. X}
  1327. END_OF_FILE
  1328. if test 1397 -ne `wc -c <'execl.c'`; then
  1329.     echo shar: \"'execl.c'\" unpacked with wrong size!
  1330. fi
  1331. chmod +x 'execl.c'
  1332. # end of 'execl.c'
  1333. fi
  1334. if test -f 'fs.awk' -a "${1}" != "-c" ; then 
  1335.   echo shar: Will not clobber existing file \"'fs.awk'\"
  1336. else
  1337. echo shar: Extracting \"'fs.awk'\" \(2188 characters\)
  1338. sed "s/^X//" >'fs.awk' <<'END_OF_FILE'
  1339. X###############################################################################
  1340. X#  The BYTE UNIX Benchmarks - Release 2
  1341. X#          Module: fs.awk   SID: 2.5 4/17/90 16:45:40
  1342. X#          
  1343. X###############################################################################
  1344. X# Bug reports, patches, comments, suggestions should be sent to:
  1345. X#
  1346. X#    Ben Smith or Rick Grehan at BYTE Magazine
  1347. X#    ben@bytepb.UUCP    rick_g@bytepb.UUCP
  1348. X#
  1349. X###############################################################################
  1350. X#  Modification Log:
  1351. X#       added geometric mean 8/6/89 -ben
  1352. X#       modified for new version of fstime 11/15/89
  1353. X#
  1354. X###############################################################################
  1355. XBEGIN   { w_product = 0.0000;
  1356. X    r_product = 0.0000;
  1357. X    c_product = 0.0000;
  1358. X    iter=0;
  1359. X    w_too_quick=0;
  1360. X    r_too_quick=0;
  1361. X    c_too_quick=0;
  1362. X    }
  1363. X/real/    { iter++; ok++; next; }
  1364. X/user/    { next; }
  1365. X/sys/    { next; }
  1366. X/^$/    { next; } 
  1367. X/fstime/ {
  1368. X         print "** Iteration ",iter," Failed: ",$0; 
  1369. X     ok--;
  1370. X         fail=1;
  1371. X         } 
  1372. X/write/ { if (!fail) {
  1373. X           w+=$1;
  1374. X           w2+=$1*$1;
  1375. X           w_product += log($1); 
  1376. X           }
  1377. X        }
  1378. X/read/  { if (!fail) {
  1379. X           r+=$1;
  1380. X           r2+=$1*$1;
  1381. X           r_product += log($1); 
  1382. X           }
  1383. X        }
  1384. X/copy/  { if (!fail) {
  1385. X           c+=$1;
  1386. X           c2+=$1*$1;
  1387. X           c_product += log($1);
  1388. X           }
  1389. X    }
  1390. XEND {
  1391. X    if (ok != iter) {
  1392. X       printf "For %d successful iterations from %d attempts ...\n",ok,iter;
  1393. X    }
  1394. X    if (ok > 0) {
  1395. X        printf "                       Arithmetric        Geometric         Variance\n";
  1396. X        printf "                              Mean             Mean         (%d tests)\n",ok
  1397. X        printf "Read (Kbytes/sec):        %9.0f        %9.0f         ",r/ok,exp(r_product/ok);
  1398. X        if (ok > 1) printf "%9.2f\n",(r2-r*r/ok)/(ok-1);
  1399. X        else printf "n/a\n"
  1400. X        printf "Write (Kbytes/sec):       %9.0f        %9.0f         ",w/ok,exp(w_product/ok);
  1401. X        if (ok > 1) printf "%9.2f\n",(w2-w*w/ok)/(ok-1);
  1402. X        else printf "n/a\n"
  1403. X        printf "Copy (Kbytes/sec):        %9.0f        %9.0f         ",c/ok,exp(c_product/ok);
  1404. X        if (ok > 1) printf "%9.2f\n",(c2-c*c/ok)/(ok-1);
  1405. X        else printf "n/a\n"
  1406. X    } else {
  1407. X        print "-- no measured results --"
  1408. X    }
  1409. X    }
  1410. END_OF_FILE
  1411. if test 2188 -ne `wc -c <'fs.awk'`; then
  1412.     echo shar: \"'fs.awk'\" unpacked with wrong size!
  1413. fi
  1414. chmod +x 'fs.awk'
  1415. # end of 'fs.awk'
  1416. fi
  1417. if test -f 'getopt.c' -a "${1}" != "-c" ; then 
  1418.   echo shar: Will not clobber existing file \"'getopt.c'\"
  1419. else
  1420. echo shar: Extracting \"'getopt.c'\" \(2468 characters\)
  1421. sed "s/^X//" >'getopt.c' <<'END_OF_FILE'
  1422. X/*
  1423. X**    @(#)getopt.c    2.5 (smail) 9/15/87
  1424. X*/
  1425. X
  1426. X/*
  1427. X * Here's something you've all been waiting for:  the AT&T public domain
  1428. X * source for getopt(3).  It is the code which was given out at the 1985
  1429. X * UNIFORUM conference in Dallas.  I obtained it by electronic mail
  1430. X * directly from AT&T.  The people there assure me that it is indeed
  1431. X * in the public domain.
  1432. X * 
  1433. X * There is no manual page.  That is because the one they gave out at
  1434. X * UNIFORUM was slightly different from the current System V Release 2
  1435. X * manual page.  The difference apparently involved a note about the
  1436. X * famous rules 5 and 6, recommending using white space between an option
  1437. X * and its first argument, and not grouping options that have arguments.
  1438. X * Getopt itself is currently lenient about both of these things White
  1439. X * space is allowed, but not mandatory, and the last option in a group can
  1440. X * have an argument.  That particular version of the man page evidently
  1441. X * has no official existence, and my source at AT&T did not send a copy.
  1442. X * The current SVR2 man page reflects the actual behavor of this getopt.
  1443. X * However, I am not about to post a copy of anything licensed by AT&T.
  1444. X */
  1445. X
  1446. X/* This include is needed only to get "index" defined as "strchr" on Sys V. */
  1447. X#include "defs.h"
  1448. X
  1449. X/*LINTLIBRARY*/
  1450. X#define NULL    0
  1451. X#define EOF    (-1)
  1452. X#define ERR(s, c)    if(opterr){\
  1453. X    extern int write();\
  1454. X    char errbuf[2];\
  1455. X    errbuf[0] = c; errbuf[1] = '\n';\
  1456. X    (void) write(2, argv[0], (unsigned)strlen(argv[0]));\
  1457. X    (void) write(2, s, (unsigned)strlen(s));\
  1458. X    (void) write(2, errbuf, 2);}
  1459. X
  1460. Xextern char *index();
  1461. X
  1462. Xint    opterr = 1;
  1463. Xint    optind = 1;
  1464. Xint    optopt;
  1465. Xchar    *optarg;
  1466. X
  1467. Xint
  1468. Xgetopt(argc, argv, opts)
  1469. Xint    argc;
  1470. Xchar    **argv, *opts;
  1471. X{
  1472. X    static int sp = 1;
  1473. X    register int c;
  1474. X    register char *cp;
  1475. X
  1476. X    if(sp == 1)
  1477. X        if(optind >= argc ||
  1478. X           argv[optind][0] != '-' || argv[optind][1] == '\0')
  1479. X            return(EOF);
  1480. X        else if(strcmp(argv[optind], "--") == NULL) {
  1481. X            optind++;
  1482. X            return(EOF);
  1483. X        }
  1484. X    optopt = c = argv[optind][sp];
  1485. X    if(c == ':' || (cp=index(opts, c)) == NULL) {
  1486. X        ERR(": illegal option -- ", c);
  1487. X        if(argv[optind][++sp] == '\0') {
  1488. X            optind++;
  1489. X            sp = 1;
  1490. X        }
  1491. X        return('?');
  1492. X    }
  1493. X    if(*++cp == ':') {
  1494. X        if(argv[optind][sp+1] != '\0')
  1495. X            optarg = &argv[optind++][sp+1];
  1496. X        else if(++optind >= argc) {
  1497. X            ERR(": option requires an argument -- ", c);
  1498. X            sp = 1;
  1499. X            return('?');
  1500. X        } else
  1501. X            optarg = argv[optind++];
  1502. X        sp = 1;
  1503. X    } else {
  1504. X        if(argv[optind][++sp] == '\0') {
  1505. X            sp = 1;
  1506. X            optind++;
  1507. X        }
  1508. X        optarg = NULL;
  1509. X    }
  1510. X    return(c);
  1511. X}
  1512. END_OF_FILE
  1513. if test 2468 -ne `wc -c <'getopt.c'`; then
  1514.     echo shar: \"'getopt.c'\" unpacked with wrong size!
  1515. fi
  1516. chmod +x 'getopt.c'
  1517. # end of 'getopt.c'
  1518. fi
  1519. if test -f 'hanoi.c' -a "${1}" != "-c" ; then 
  1520.   echo shar: Will not clobber existing file \"'hanoi.c'\"
  1521. else
  1522. echo shar: Extracting \"'hanoi.c'\" \(1293 characters\)
  1523. sed "s/^X//" >'hanoi.c' <<'END_OF_FILE'
  1524. X/*******************************************************************************
  1525. X *  The BYTE UNIX Benchmarks - Release 2
  1526. X *          Module: hanoi.c   SID: 2.4 4/17/90 16:45:34
  1527. X *          
  1528. X *******************************************************************************
  1529. X * Bug reports, patches, comments, suggestions should be sent to:
  1530. X *
  1531. X *    Ben Smith or Rick Grehan at BYTE Magazine
  1532. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  1533. X *
  1534. X *******************************************************************************
  1535. X *  Modification Log:
  1536. X *  $Header: hanoi.c,v 3.5 87/08/06 08:11:14 kenj Exp $
  1537. X *
  1538. X ******************************************************************************/
  1539. X
  1540. Xchar SCCSid[] = "@(#) @(#)hanoi.c:2.4 -- 4/17/90 16:45:34";
  1541. X#define PRINT 0
  1542. X#define DISK 3
  1543. X#define other(i,j) (6-(i+j))
  1544. Xint num[4];
  1545. Xlong cnt;
  1546. Xmain(argc,argv)
  1547. Xchar **argv;
  1548. X{
  1549. X    int disk;
  1550. X    disk  = DISK;
  1551. X    if(argc > 1)disk = atoi(argv[1]);
  1552. X    num[1] = disk;
  1553. X    if(PRINT)printf("Start %d on A\n",disk);
  1554. X    mov(disk,1,3);
  1555. X    printf("For %d disks, %ld moves\n",disk,cnt);
  1556. X
  1557. X    exit(0);
  1558. X}
  1559. X
  1560. Xmov(n,f,t)
  1561. X{
  1562. X    int o;
  1563. X    if(n == 1) {
  1564. X        num[f]--;
  1565. X        num[t]++;
  1566. X        if(PRINT)printf("Move from %d to %d, result: A:%d B:%d C%d\n",
  1567. X            f,t,num[1],num[2],num[3]);
  1568. X        cnt++;
  1569. X        return;
  1570. X    }
  1571. X    o = other(f,t);
  1572. X    mov(n-1,f,o);
  1573. X    mov(1,f,t);
  1574. X    mov(n-1,o,t);
  1575. X    return;
  1576. X}
  1577. END_OF_FILE
  1578. if test 1293 -ne `wc -c <'hanoi.c'`; then
  1579.     echo shar: \"'hanoi.c'\" unpacked with wrong size!
  1580. fi
  1581. chmod +x 'hanoi.c'
  1582. # end of 'hanoi.c'
  1583. fi
  1584. if test -f 'limit.c' -a "${1}" != "-c" ; then 
  1585.   echo shar: Will not clobber existing file \"'limit.c'\"
  1586. else
  1587. echo shar: Extracting \"'limit.c'\" \(3268 characters\)
  1588. sed "s/^X//" >'limit.c' <<'END_OF_FILE'
  1589. X/*******************************************************************************
  1590. X *  The BYTE UNIX Benchmarks - Release 2
  1591. X *          Module: limit.c   SID: 2.4 4/17/90 16:45:34
  1592. X *          
  1593. X *******************************************************************************
  1594. X * Bug reports, patches, comments, suggestions should be sent to:
  1595. X *
  1596. X *    Ben Smith or Rick Grehan at BYTE Magazine
  1597. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  1598. X *
  1599. X *******************************************************************************
  1600. X *  Modification Log:
  1601. X *  $Header: limit.c,v 3.4 87/06/22 14:25:11 kjmcdonell Beta $
  1602. X *
  1603. X ******************************************************************************/
  1604. Xchar SCCSid[] = "@(#) @(#)limit.c:2.4 -- 4/17/90 16:45:34";
  1605. X/*
  1606. X *  Force a UNIX system to the per process and per user limits
  1607. X *
  1608. X */
  1609. X
  1610. X#define    CLICK    1024
  1611. X#define    MAXCHN    100
  1612. X
  1613. X#include <signal.h>
  1614. X#include <setjmp.h>
  1615. X
  1616. Xint    parent;        /* parent's pid */
  1617. Xint    child;        /* child's pid */
  1618. Xint    pid[MAXCHN];
  1619. Xint    ncall;
  1620. Xint    level;
  1621. Xjmp_buf    env;
  1622. X
  1623. Xmain(argc, argv)
  1624. Xint    argc;
  1625. Xchar    *argv[];
  1626. X{
  1627. X    char    *top;
  1628. X    int    pad;
  1629. X    int    end;
  1630. X    int    i;
  1631. X    int    status;
  1632. X    float    f;
  1633. X    int    flag();
  1634. X    int    wakeup();
  1635. X    long    last;
  1636. X
  1637. X    /* open files (file descriptors) */
  1638. X    for (i = 3; open(".", 0) > 0; i++) ;
  1639. X    printf("Maximum open files per process: %d\n", i);
  1640. X    while (--i > 2)
  1641. X        close(i);
  1642. X
  1643. X    /* process address space */
  1644. X    top = (char *)sbrk(0);
  1645. X#if debug
  1646. X    printf("inital top of program: 0x%x\n", top);
  1647. X#endif
  1648. X    pad = (((int)top+CLICK-1)/CLICK)*CLICK - (int)top;
  1649. X    sbrk(pad);
  1650. X    for (i = 0; (char *)sbrk(CLICK) != (char *)-1; i++) ;
  1651. X#if debug
  1652. X    printf("final top of program: 0x%x\n", sbrk(0));
  1653. X#endif
  1654. X    brk(top);
  1655. X#if debug
  1656. X    printf("top of program restored to: 0x%x\n", sbrk(0));
  1657. X#endif
  1658. X    end = (((int)top+pad)/CLICK) + i;
  1659. X    f = ((float)end * CLICK) / 1024;
  1660. X    printf("Process address space limit: ");
  1661. X    if (f < 1024)
  1662. X        printf("%.2f Kbytes\n", f);
  1663. X    else {
  1664. X        f /= 1024;
  1665. X        printf("%.2f Mbytes\n", f);
  1666. X    }
  1667. X
  1668. X    /* process creations */
  1669. X    printf("Maximum number of child processes:");
  1670. X    i = 0;
  1671. X    while (1) {
  1672. X#if debug
  1673. X        printf("about to fork\n");
  1674. X#endif
  1675. X        if ((pid[i] = fork()) == -1) {
  1676. X#if debug
  1677. X            perror("fork failed");
  1678. X#endif
  1679. X            break;
  1680. X        } else if (pid[i] != 0) {
  1681. X#if debug
  1682. X            printf("child %d: pid=%d\n", i+1, pid[i]);
  1683. X#endif
  1684. X            i++;
  1685. X            if (i >= MAXCHN) {
  1686. X                printf(" more than");
  1687. X                break;
  1688. X            }
  1689. X        } else {
  1690. X#if debug
  1691. X            printf("child %d pausing\n", getpid());
  1692. X#endif
  1693. X            pause();
  1694. X#if debug
  1695. X            printf("child %d exiting\n", getpid());
  1696. X#endif
  1697. X            exit(1);
  1698. X        }
  1699. X    }
  1700. X    printf(" %d\n", i);
  1701. X    while (--i >= 0) {
  1702. X        kill(pid[i], SIGKILL);
  1703. X        wait(0);
  1704. X    }
  1705. X
  1706. X    ncall = level = 0;
  1707. X    parent = getpid();
  1708. X    signal(SIGTERM, flag);
  1709. X    if ((child = fork()) == 0) {
  1710. X        signal(SIGALRM, wakeup);
  1711. X        recurse();
  1712. X        exit(4);
  1713. X    }
  1714. X    while ((i = wait(&status)) == -1) {
  1715. X    }
  1716. X    printf("Estimated maximum stack size: %d Kbytes\n", level);
  1717. X    exit(0);
  1718. X}
  1719. X
  1720. Xrecurse()
  1721. X{
  1722. X    int    temp[1024 / sizeof(int)];
  1723. X#if debug
  1724. X    printf("recursion @ level %d\n", ncall);
  1725. X#endif
  1726. X    temp[1024 / sizeof(int) - 1] = 1;
  1727. X    ncall++;
  1728. X    kill(parent, SIGTERM);
  1729. X    while (ncall > level) {
  1730. X        alarm(2);
  1731. X        pause();
  1732. X    }
  1733. X    if (ncall < 8000)
  1734. X        /* less than 8M bytes of temp storage! */
  1735. X        recurse();
  1736. X    else
  1737. X        /* give up! */
  1738. X        exit(0);
  1739. X}
  1740. X
  1741. Xflag()
  1742. X{
  1743. X    signal(SIGTERM, flag);
  1744. X    level++;
  1745. X    if (child != 0)
  1746. X        kill(child, SIGTERM);
  1747. X}
  1748. X
  1749. Xwakeup()
  1750. X{
  1751. X    signal(SIGALRM, wakeup);
  1752. X}
  1753. END_OF_FILE
  1754. if test 3268 -ne `wc -c <'limit.c'`; then
  1755.     echo shar: \"'limit.c'\" unpacked with wrong size!
  1756. fi
  1757. chmod +x 'limit.c'
  1758. # end of 'limit.c'
  1759. fi
  1760. if test -f 'mkperm.c' -a "${1}" != "-c" ; then 
  1761.   echo shar: Will not clobber existing file \"'mkperm.c'\"
  1762. else
  1763. echo shar: Extracting \"'mkperm.c'\" \(1389 characters\)
  1764. sed "s/^X//" >'mkperm.c' <<'END_OF_FILE'
  1765. X/*******************************************************************************
  1766. X *  The BYTE UNIX Benchmarks - Release 2
  1767. X *          Module: mkperm.c   SID: 2.4 4/17/90 16:45:35
  1768. X *          
  1769. X *******************************************************************************
  1770. X * Bug reports, patches, comments, suggestions should be sent to:
  1771. X *
  1772. X *    Ben Smith or Rick Grehan at BYTE Magazine
  1773. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  1774. X *
  1775. X *******************************************************************************
  1776. X *  Modification Log:
  1777. X *  $Header: mkperm.c,v 1.2 87/06/22 14:32:26 kjmcdonell Beta $
  1778. X *
  1779. X ******************************************************************************/
  1780. Xchar SCCSid[] = "@(#) @(#)mkperm.c:2.4 -- 4/17/90 16:45:35";
  1781. X#include <stdio.h>
  1782. X#ifndef lint
  1783. X#endif
  1784. X
  1785. X/* define rand and srand if you have random() from USENET */
  1786. X/* #define rand random */
  1787. X/* #define srand srandom */
  1788. X
  1789. Xmain(argc, argv)
  1790. Xint    argc;
  1791. Xchar    *argv[];
  1792. X{
  1793. X    int    n;    /* generate a permutation of {1,2,3,...,n} */
  1794. X    int    i;
  1795. X    int    t;
  1796. X    char    *mask;
  1797. X
  1798. X    if (argc > 2 && strcmp(argv[1], "-s") == 0) {
  1799. X        t = atoi(argv[2]);
  1800. X        if (t < 16)
  1801. X            t = 1 << t;
  1802. X        srand(t);
  1803. X        argv++;
  1804. X        argv++;
  1805. X    }
  1806. X    n = atoi(argv[1]);
  1807. X    mask = (char *)malloc(n);
  1808. X
  1809. X    for (i=0; i<n; i++)
  1810. X        mask[i] = '\0';
  1811. X    for (i=0; i<n; i++) {
  1812. X        do {
  1813. X            t = rand() % n;
  1814. X        } while (mask[t]);
  1815. X        mask[t] = '\1';
  1816. X        printf("%d ", t+1);
  1817. X    }
  1818. X    putchar('\n');
  1819. X    exit(0);
  1820. X}
  1821. END_OF_FILE
  1822. if test 1389 -ne `wc -c <'mkperm.c'`; then
  1823.     echo shar: \"'mkperm.c'\" unpacked with wrong size!
  1824. fi
  1825. chmod +x 'mkperm.c'
  1826. # end of 'mkperm.c'
  1827. fi
  1828. if test -f 'multi.sh' -a "${1}" != "-c" ; then 
  1829.   echo shar: Will not clobber existing file \"'multi.sh'\"
  1830. else
  1831. echo shar: Extracting \"'multi.sh'\" \(704 characters\)
  1832. sed "s/^X//" >'multi.sh' <<'END_OF_FILE'
  1833. X#! /bin/sh
  1834. X###############################################################################
  1835. X#  The BYTE UNIX Benchmarks - Release 2
  1836. X#          Module: multi.sh   SID: 2.3 4/17/90 16:45:41
  1837. X#          
  1838. X###############################################################################
  1839. X# Bug reports, patches, comments, suggestions should be sent to:
  1840. X#
  1841. X#    Ben Smith or Rick Grehan at BYTE Magazine
  1842. X#    ben@bytepb.UUCP    rick_g@bytepb.UUCP
  1843. X#
  1844. X###############################################################################
  1845. X#  Modification Log:
  1846. X#
  1847. X###############################################################################
  1848. XID="@(#)multi.sh:2.3 -- 4/17/90 16:45:41";
  1849. Xfor i
  1850. Xdo
  1851. X    /bin/sh $BINDIR/tst.sh &
  1852. Xdone
  1853. Xwait
  1854. X
  1855. END_OF_FILE
  1856. if test 704 -ne `wc -c <'multi.sh'`; then
  1857.     echo shar: \"'multi.sh'\" unpacked with wrong size!
  1858. fi
  1859. chmod +x 'multi.sh'
  1860. # end of 'multi.sh'
  1861. fi
  1862. if test -f 'pipe.c' -a "${1}" != "-c" ; then 
  1863.   echo shar: Will not clobber existing file \"'pipe.c'\"
  1864. else
  1865. echo shar: Extracting \"'pipe.c'\" \(1212 characters\)
  1866. sed "s/^X//" >'pipe.c' <<'END_OF_FILE'
  1867. X/*******************************************************************************
  1868. X *  The BYTE UNIX Benchmarks - Release 2
  1869. X *          Module: pipe.c   SID: 2.4 4/17/90 16:45:35
  1870. X *          
  1871. X *******************************************************************************
  1872. X * Bug reports, patches, comments, suggestions should be sent to:
  1873. X *
  1874. X *    Ben Smith or Rick Grehan at BYTE Magazine
  1875. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  1876. X *
  1877. X *******************************************************************************
  1878. X *  Modification Log:
  1879. X *  $Header: pipe.c,v 3.5 87/06/22 14:32:36 kjmcdonell Beta $
  1880. X *
  1881. X ******************************************************************************/
  1882. Xchar SCCSid[] = "@(#) @(#)pipe.c:2.4 -- 4/17/90 16:45:35";
  1883. X/*
  1884. X *  pipe  -- test single process pipe throughput (no context switching)
  1885. X *
  1886. X */
  1887. X
  1888. Xmain(argc, argv)
  1889. Xint    argc;
  1890. Xchar    *argv[];
  1891. X{
  1892. X    char    buf[512];
  1893. X    int    iter = 2048;    /* 1M byte */
  1894. X    int    pvec[2];
  1895. X
  1896. X    pipe(pvec);
  1897. X    close(0); dup(pvec[0]); close(pvec[0]);
  1898. X    close(1); dup(pvec[1]); close(pvec[1]);
  1899. X
  1900. X    while (iter-- > 0) {
  1901. X        if (write(1, buf, sizeof(buf)) != sizeof(buf))
  1902. X            perror("write failed");
  1903. X        if (read(0, buf, sizeof(buf)) != sizeof(buf))
  1904. X            perror("read failed");
  1905. X    }
  1906. X    exit(0);
  1907. X}
  1908. END_OF_FILE
  1909. if test 1212 -ne `wc -c <'pipe.c'`; then
  1910.     echo shar: \"'pipe.c'\" unpacked with wrong size!
  1911. fi
  1912. chmod +x 'pipe.c'
  1913. # end of 'pipe.c'
  1914. fi
  1915. if test -f 'spawn.c' -a "${1}" != "-c" ; then 
  1916.   echo shar: Will not clobber existing file \"'spawn.c'\"
  1917. else
  1918. echo shar: Extracting \"'spawn.c'\" \(1390 characters\)
  1919. sed "s/^X//" >'spawn.c' <<'END_OF_FILE'
  1920. X/*******************************************************************************
  1921. X *  The BYTE UNIX Benchmarks - Release 2
  1922. X *          Module: spawn.c   SID: 2.4 4/17/90 16:45:35
  1923. X *          
  1924. X *******************************************************************************
  1925. X * Bug reports, patches, comments, suggestions should be sent to:
  1926. X *
  1927. X *    Ben Smith or Rick Grehan at BYTE Magazine
  1928. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  1929. X *
  1930. X *******************************************************************************
  1931. X *  Modification Log:
  1932. X *  $Header: spawn.c,v 3.4 87/06/22 14:32:48 kjmcdonell Beta $
  1933. X *
  1934. X ******************************************************************************/
  1935. Xchar SCCSid[] = "@(#) @(#)spawn.c:2.4 -- 4/17/90 16:45:35";
  1936. X/*
  1937. X *  Process creation
  1938. X *
  1939. X */
  1940. X
  1941. Xmain(argc, argv)
  1942. Xint    argc;
  1943. Xchar    *argv[];
  1944. X{
  1945. X    int    iter;
  1946. X    int    slave;
  1947. X    int    status;
  1948. X
  1949. X    if (argc != 2) {
  1950. X        printf("Usage: %s count\n", argv[0]);
  1951. X        exit(1);
  1952. X    }
  1953. X
  1954. X    iter = atoi(argv[1]);
  1955. X
  1956. X    while (iter-- > 0) {
  1957. X        if ((slave = fork()) == 0) {
  1958. X            /* slave .. boring */
  1959. X#if debug
  1960. X            printf("fork OK\n");
  1961. X#endif
  1962. X            exit(0);
  1963. X        } else if (slave < 0) {
  1964. X            /* woops ... */
  1965. X            printf("Fork failed at iteration %d\n", iter);
  1966. X            perror("Reason");
  1967. X            exit(2);
  1968. X        } else
  1969. X            wait(&status);
  1970. X        if (status != 0) {
  1971. X            printf("Bad wait status: 0x%x\n", status);
  1972. X            exit(2);
  1973. X        }
  1974. X#if debug
  1975. X        printf("Child %d done.\n", slave);
  1976. X#endif
  1977. X    }
  1978. X    exit(0);
  1979. X}
  1980. END_OF_FILE
  1981. if test 1390 -ne `wc -c <'spawn.c'`; then
  1982.     echo shar: \"'spawn.c'\" unpacked with wrong size!
  1983. fi
  1984. chmod +x 'spawn.c'
  1985. # end of 'spawn.c'
  1986. fi
  1987. if test -f 'syscall.c' -a "${1}" != "-c" ; then 
  1988.   echo shar: Will not clobber existing file \"'syscall.c'\"
  1989. else
  1990. echo shar: Extracting \"'syscall.c'\" \(1061 characters\)
  1991. sed "s/^X//" >'syscall.c' <<'END_OF_FILE'
  1992. X/*******************************************************************************
  1993. X *  The BYTE UNIX Benchmarks - Release 2
  1994. X *          Module: syscall.c   SID: 2.4 4/17/90 16:45:36
  1995. X *          
  1996. X *******************************************************************************
  1997. X * Bug reports, patches, comments, suggestions should be sent to:
  1998. X *
  1999. X *    Ben Smith or Rick Grehan at BYTE Magazine
  2000. X *    bensmith@bixpb.UUCP    rick_g@bixpb.UUCP
  2001. X *
  2002. X *******************************************************************************
  2003. X *  Modification Log:
  2004. X *  $Header: syscall.c,v 3.4 87/06/22 14:32:54 kjmcdonell Beta $
  2005. X *
  2006. X ******************************************************************************/
  2007. Xchar SCCSid[] = "@(#) @(#)syscall.c:2.4 -- 4/17/90 16:45:36";
  2008. X/*
  2009. X *  syscall  -- sit in a loop calling the system
  2010. X *
  2011. X */
  2012. X
  2013. Xmain(argc, argv)
  2014. Xint    argc;
  2015. Xchar    *argv[];
  2016. X{
  2017. X    int    iter;
  2018. X    int    i;
  2019. X
  2020. X    if (argc != 2) {
  2021. X        printf("Usage: %s count\n", argv[0]);
  2022. X        exit(1);
  2023. X    }
  2024. X
  2025. X    iter = atoi(argv[1]);
  2026. X
  2027. X    while (iter-- > 0) {
  2028. X        close(dup(0));
  2029. X        getpid();
  2030. X        getuid();
  2031. X        umask(022);
  2032. X    }
  2033. X    exit(0);
  2034. X}
  2035. END_OF_FILE
  2036. if test 1061 -ne `wc -c <'syscall.c'`; then
  2037.     echo shar: \"'syscall.c'\" unpacked with wrong size!
  2038. fi
  2039. chmod +x 'syscall.c'
  2040. # end of 'syscall.c'
  2041. fi
  2042. if test -f 'time.awk' -a "${1}" != "-c" ; then 
  2043.   echo shar: Will not clobber existing file \"'time.awk'\"
  2044. else
  2045. echo shar: Extracting \"'time.awk'\" \(2196 characters\)
  2046. sed "s/^X//" >'time.awk' <<'END_OF_FILE'
  2047. X###############################################################################
  2048. X#  The BYTE UNIX Benchmarks - Release 2
  2049. X#          Module: time.awk   SID: 2.3 4/17/90 16:45:40
  2050. X#          
  2051. X###############################################################################
  2052. X# Bug reports, patches, comments, suggestions should be sent to:
  2053. X#
  2054. X#    Ben Smith or Rick Grehan at BYTE Magazine
  2055. X#    ben@bytepb.UUCP    rick_g@bytepb.UUCP
  2056. X#
  2057. X###############################################################################
  2058. X#  Modification Log:
  2059. X#       added geometric mean 8/6/89 -ben
  2060. X#
  2061. X###############################################################################
  2062. XBEGIN      { r_product = 0.0000; s_product = 0.0000 ; u_product = 0.0000 }
  2063. X/^cctest.c$/    { next }
  2064. X/^[Rr]eal/ {
  2065. X    if (!fail) {
  2066. X        l=length($2); m=substr($2,1,l-5); s=substr($2,l-3,4)
  2067. X        t=m*60+s; real+=t; r2+=t*t; ok++;
  2068. X        if (t) {r_product += log(t);}
  2069. X    }
  2070. X    iter++; fail=0; next }
  2071. X/^[Uu]ser/ {
  2072. X    l=length($2); m=substr($2,1,l-5); s=substr($2,l-3,4)
  2073. X    t=m*60+s; user+=t; cpu=t; u2+=t*t;
  2074. X    if (t) { u_product += log(t);}
  2075. X    next; }
  2076. X/^[Ss]ys/ {
  2077. X    l=length($2); m=substr($2,1,l-5); s=substr($2,l-3,4)
  2078. X    t=m*60+s; sys+=t; s2+=t*t; 
  2079. X    if (t) { s_product += log(t);}
  2080. X    next; }
  2081. X/^$/    { next }
  2082. X    { print "** Iteration ",iter+1," Failed: ",$0; fail=1 }
  2083. XEND {
  2084. X    if (fail) iter++
  2085. X    if (ok != iter) {
  2086. X        printf "For %d successful iterations from %d attempts ...\n",ok,iter
  2087. X        iter=ok;
  2088. X    }
  2089. X    if (ok > 0) {
  2090. X        printf "                       Arithmetric        Geometric         Variance\n";
  2091. X        printf "                              Mean             Mean         (%d tests)\n",ok
  2092. X        printf "User Time (secs):        %9.2f        %9.2f         ",user/ok,exp(u_product/ok);
  2093. X        if (ok > 1) printf "%9.2f\n",(u2-user*user/ok)/(ok-1);
  2094. X        else printf "n/a\n"
  2095. X        printf "System Time (secs):      %9.2f        %9.2f         ",sys/ok,exp(s_product/ok);
  2096. X        if (ok > 1) printf "%9.2f\n",(s2-sys*sys/ok)/(ok-1);
  2097. X        else printf "n/a\n"
  2098. X        printf "Real Time (secs):        %9.2f        %9.2f         ",real/ok,exp(r_product/ok);
  2099. X        if (ok > 1) printf "%9.2f\n",(r2-real*real/ok)/(ok-1);
  2100. X        else printf "n/a\n"
  2101. X    } else {
  2102. X        print "-- no measured results --"
  2103. X    }
  2104. X    }
  2105. END_OF_FILE
  2106. if test 2196 -ne `wc -c <'time.awk'`; then
  2107.     echo shar: \"'time.awk'\" unpacked with wrong size!
  2108. fi
  2109. chmod +x 'time.awk'
  2110. # end of 'time.awk'
  2111. fi
  2112. if test -f 'tst.sh' -a "${1}" != "-c" ; then 
  2113.   echo shar: Will not clobber existing file \"'tst.sh'\"
  2114. else
  2115. echo shar: Extracting \"'tst.sh'\" \(785 characters\)
  2116. sed "s/^X//" >'tst.sh' <<'END_OF_FILE'
  2117. X#! /bin/sh
  2118. X###############################################################################
  2119. X#  The BYTE UNIX Benchmarks - Release 2
  2120. X#          Module: tst.sh   SID: 2.3 4/17/90 16:45:41
  2121. X#          
  2122. X###############################################################################
  2123. X# Bug reports, patches, comments, suggestions should be sent to:
  2124. X#
  2125. X#    Ben Smith or Rick Grehan at BYTE Magazine
  2126. X#    ben@bytepb.UUCP    rick_g@bytepb.UUCP
  2127. X#
  2128. X###############################################################################
  2129. X#  Modification Log:
  2130. X#
  2131. X###############################################################################
  2132. XID="@(#)tst.sh:2.3 -- 4/17/90 16:45:41";
  2133. Xsort >sort.$$ <sort.src
  2134. Xod sort.$$ | sort -n +1 > od.$$
  2135. Xgrep the sort.$$ | tee grep.$$ | wc > wc.$$
  2136. Xrm sort.$$ grep.$$ od.$$ wc.$$
  2137. END_OF_FILE
  2138. if test 785 -ne `wc -c <'tst.sh'`; then
  2139.     echo shar: \"'tst.sh'\" unpacked with wrong size!
  2140. fi
  2141. chmod +x 'tst.sh'
  2142. # end of 'tst.sh'
  2143. fi
  2144. echo shar: End of archive 1 \(of 5\).
  2145. cp /dev/null ark1isdone
  2146. MISSING=""
  2147. for I in 1 2 3 4 5 ; do
  2148.     if test ! -f ark${I}isdone ; then
  2149.     MISSING="${MISSING} ${I}"
  2150.     fi
  2151. done
  2152. if test "${MISSING}" = "" ; then
  2153.     echo You have unpacked all 5 archives.
  2154.     rm -f ark[1-9]isdone
  2155. else
  2156.     echo You still need to unpack the following archives:
  2157.     echo "        " ${MISSING}
  2158. fi
  2159. ##  End of shell archive.
  2160. exit 0
  2161. exit 0 # Just in case...
  2162.